import React, { Component } from 'react';
import PlanItem from './PlanItem';

export default class PlanList extends Component {
  render() {
    const{planItems,cardStore} = this.props;
    let items = [];
    planItems.forEach((item) => {  
        let itemProps = {
            key : item.id,
            id: item.id,
            name : item.name,
            description : item.description,
            endMonth : item.endMonth,
            endDay : item.endDay,
            canEdit: item.canEdit,
            canComplete: item.canComplete,
            status : item.status,
            statusSpan : item.statusSpan
        };
        // const showBottom = (index < contacterItems.length - 1);
        items.push(
            <PlanItem
                {...itemProps}
                onItemClick={this.props.onItemClick}
                showBottom={true}
                cardStore={cardStore}
            />
        );
    });

    return (        
      <div className="crm-card-contacter-list">
        {items}
      </div>
    );
  }
}